//
//  StarDetailView.m
//  LiveStar
//
//  Created by 漪珊 on 2017/1/17.
//  Copyright © 2017年 apple. All rights reserved.
//

#import "StarDetailView.h"

@implementation StarDetailView
- (void)awakeFromNib {
    [super awakeFromNib];
    self.liveStateBtn.hidden = YES;
    self.frame = CGRectMake(0, 0, kSCREEN_WIDTH,284*kScale);
    self.backImage.frame = self.frame;
    self.backView.frame = self.frame;
    self.backView.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.6];
    self.toolView.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.5];
    kButtonBorderRadius(self.liveStateBtn, self.liveStateBtn.width/2, 0.5, [UIColor whiteColor]);
    kImageViewRadius(self.starImgView, self.starImgView.width/2);
    self.starTag1.layer.borderWidth = 0.5;
    self.starTag1.layer.borderColor = [UIColor whiteColor].CGColor;
    self.starTag2.layer.borderWidth = 0.5;
    self.starTag2.layer.borderColor = [UIColor whiteColor].CGColor;
    self.starTag3.layer.borderWidth = 0.5;
    self.starTag3.layer.borderColor = [UIColor whiteColor].CGColor;
    self.starTag4.layer.borderWidth = 0.5;
    self.starTag4.layer.borderColor = [UIColor whiteColor].CGColor;
    self.starTag1.hidden = NO;
    self.starTag2.hidden = YES;
    self.starTag3.hidden = YES;
    self.starTag4.hidden = YES;
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(ItemAction:)];
    UITapGestureRecognizer *tap1 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(ItemAction:)];
    UITapGestureRecognizer *tap2 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(ItemAction:)];
    [self.predictItem addGestureRecognizer:tap];
    [self.videoItem addGestureRecognizer:tap1];
    [self.trendItem addGestureRecognizer:tap2];

    UITapGestureRecognizer *tap3 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(ItemAction:)];
    [self.backView addGestureRecognizer:tap3];
    
}

#pragma mark -- 返回按钮点击事件
- (IBAction)goBack:(id)sender {
    [self.delegate popController];
}

- (void)ItemAction:(UITapGestureRecognizer *)tap {
    if ([self.delegate respondsToSelector:@selector(ItemClickWithTag:)]) {
        if (tap.view == self.predictItem) {
            [self.delegate ItemClickWithTag:1];
        } else if (tap.view == self.videoItem) {
            [self.delegate ItemClickWithTag:2];
        } else if (tap.view == self.trendItem) {
            [self.delegate ItemClickWithTag:3];
        } else if (tap.view == self.backView) {
            [self.delegate ItemClickWithTag:4];
        }
    }
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
